package com.roadjava.tutor.service.impl;

import com.roadjava.tutor.bean.dto.UserDTO;
import com.roadjava.tutor.bean.res.ResultDTO;
import com.roadjava.tutor.bean.vo.UserVO;
import com.roadjava.tutor.mapper.AdminMapper;
import com.roadjava.tutor.service.AdminService;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import javax.annotation.Resource;

/**
 * @author zhaodaowen
 * @see <a href="http://www.roadjava.com">乐之者java</a>
 */
@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminMapper adminMapper;
    @Override
    public ResultDTO<UserVO> login(UserDTO userDTO) {
        UserVO userVO = adminMapper.validateLogin(userDTO);
        if (userVO == null) {
            return ResultDTO.buildFailure("用户名或密码不正确");
        }else {
            return ResultDTO.buildSuccess(userVO);
        }
    }
}
